#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;

//数组中重复的数字，空间o(1)
bool duplicate(int numbers[], int length, int *duplication)
{
    for (int i = 0; i < length; ++i)
    {
        int index = numbers[i] % length;
        if (numbers[index] > length)
        {
            *duplication = index;
            return true;
        }
        numbers[index] += length;
    }
    return false;
}

//数组中重复的数字，空间o(n)
bool duplicate(int numbers[], int length, int *duplication)
{
    vector<int> hashmap(length, 0);
    for (int i = 0; i < length; ++i)
    {
        hashmap[numbers[i]]++;
        if (hashmap[numbers[i]] > 1)
        {
            *duplication = numbers[i];
            return true;
        }
    }
    return false;
}

void test()
{
}

int main()
{
    test();
    return 0;
}